<?php
/**
 *
 * 动态收藏取消
 *
 */
require_once(dirname(__FILE__)."/../include/common.inc.php");
$title = HtmlReplace($title,1);
$aid = intval($aid);
$addtime = time();
$type = 1;

$moxingid = $dsql->GetOne("SELECT litpic FROM `#@__archives` WHERE id='$aid'");
$litpic =$moxingid[litpic];

require_once(DEDEINC."/memberlogin.class.php");
$ml = new MemberLogin();
//查询状态
$row = $dsql->GetOne("Select * From `#@__member_stow` where aid='$aid' and mid='{$ml->M_ID}' ");
if( !is_array($row) ){
    $dsql->ExecuteNoneQuery(" INSERT INTO `#@__member_stow`(mid,aid,title,litpic,type,addtime) VALUES ('".$ml->M_ID."','$aid','$title','$litpic','$type','$addtime'); ");
 
}else{
     $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_stow` where aid='$aid' and mid='{$ml->M_ID}' ");	 
}



//更新用户统计
$row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `#@__member_stow` WHERE `mid`='{$ml->M_ID}' ");
$dsql->ExecuteNoneQuery("UPDATE #@__member_tj SET `stow`='$row[nums]' WHERE `mid`='".$ml->M_ID."'");

$arr = array(
	"status"=>"1"
);
echo json_encode($arr);
exit; 
?>